//
//  MSDayCell.m
//  觅尚
//
//  Created by No.8 on 2019/3/26.
//  Copyright © 2019 No.8. All rights reserved.
//

#import "MSDayCell.h"

@implementation MSDayCell

+ (instancetype)cellWithTableView:(UITableView *)tableView{
    MSDayCell * cell = [tableView dequeueReusableCellWithIdentifier:[MSDayCell ID]];
    cell = [[MSDayCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:[MSDayCell ID]];
    cell.backgroundColor = backgroundcolor;
    return cell;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
      [self setMember];
    }
    return self;
}
- (void)setMember{
    
    /** 部门*/
    self.departmentLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth / 3, 200 * px)];
    self.departmentLabel.textColor = WYCRGBColor(102, 121, 145);
    self.departmentLabel.text = @"客服部";
    self.departmentLabel.textAlignment = NSTextAlignmentCenter;
    self.departmentLabel.font = [UIFont systemFontOfSize:SYRealValue(30 / 2)];
    [self addSubview:self.departmentLabel];
    
    
    
    /** 部门*/
    self.NumberLabel = [[UILabel alloc] initWithFrame:CGRectMake(ScreenWidth / 3, self.departmentLabel.y, self.departmentLabel.width, self.departmentLabel.height)];
    self.NumberLabel.textColor = self.departmentLabel.textColor;
    self.NumberLabel.text = @"30/60";
    self.NumberLabel.textAlignment = NSTextAlignmentCenter;
    self.NumberLabel.font = [UIFont systemFontOfSize:SYRealValue(30 / 2)];
    [self addSubview:self.NumberLabel];
    
    
    /** 部门*/
    self.detailsButton = [[UIButton alloc] initWithFrame:CGRectMake(ScreenWidth / 3 * 2, self.departmentLabel.y, self.departmentLabel.width, self.departmentLabel.height)];
    [self.detailsButton setTitle:@"查看" forState:UIControlStateNormal];
    [self.detailsButton setTitleColor:self.departmentLabel.textColor forState:UIControlStateNormal];
    self.detailsButton.contentHorizontalAlignment = UIControlContentVerticalAlignmentCenter;
    self.detailsButton.titleLabel.font = [UIFont systemFontOfSize:SYRealValue(30 / 2)];
    [self.detailsButton addTarget:self action:@selector(detailsButtonClick) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:self.detailsButton];
}
- (void)detailsButtonClick{
    if (self.ButtonDelegate && [self.ButtonDelegate respondsToSelector:@selector(ClickDepid:)]) {
        [self.ButtonDelegate ClickDepid:self.DayStatisticsModel.depid];
    }
    
}
- (void)setDayStatisticsModel:(MSDayStatisticsModel *)DayStatisticsModel{
    _DayStatisticsModel = DayStatisticsModel;
    self.departmentLabel.text = [NSString stringWithFormat:@"%@",DayStatisticsModel.stn_alias];
    
    self.NumberLabel.text = [NSString stringWithFormat:@"%@/%@",DayStatisticsModel.clockNumber,DayStatisticsModel.departNumber];
}
+(NSString *)ID{
    return @"cell";
}

@end
